#include <stdio.h>

struct DATE
{
    int year;
    int month;
    int day;
};

int days(struct DATE date)
{
    if((date.year%4==0&&date.year%100!=0)||(date.year%400==0))
    {
       if(date.month==1) return date.day;
       if(date.month==2) return date.day+31;
       if(date.month==3) return date.day+60;
       if(date.month==4) return date.day+91;
       if(date.month==5) return date.day+121;
       if(date.month==6) return date.day+152;
       if(date.month==7) return date.day+182;
       if(date.month==8) return date.day+213;
       if(date.month==9) return date.day+336;
      if(date.month==10) return date.day+274;
      if(date.month==11) return date.day+305;
      if(date.month==12) return date.day+335;
    }
    else
    {
       if(date.month==1) return date.day;
       if(date.month==2) return date.day+31;
       if(date.month==3) return date.day+59;
       if(date.month==4) return date.day+90;
       if(date.month==5) return date.day+120;
       if(date.month==6) return date.day+151;
       if(date.month==7) return date.day+181;
       if(date.month==8) return date.day+212;
       if(date.month==9) return date.day+335;
      if(date.month==10) return date.day+273;
      if(date.month==11) return date.day+304;
      if(date.month==12) return date.day+334;
    }
}
int main()
{
    struct DATE d;
    scanf("%d-%d-%d", &d.year, &d.month, &d.day);
    printf("%d", days(d));
}
